home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / plnk081.zip / pilot-link.0.8.1 / scripts / ltmain.sh < prev    next >
Text File  |  1997-07-20  |  47KB  |  1,823 lines

  1. # ltmain.sh - Provide generalized library-building support services.
  2. # Generated automatically from ltmain.sh.in by configure.
  3. # Copyright (C) 1996, 1997 Free Software Foundation, Inc.
  4. # Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  5. #
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful, but
  12. # WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14. # General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  19. #
  20. # As a special exception to the GNU General Public License, if you
  21. # distribute this file as part of a program that contains a
  22. # configuration script generated by Autoconf, you may include it under
  23. # the same distribution terms that you use for the rest of that program.
  24.  
  25. # The name of this program.
  26. progname=`echo "$0" | sed 's%^.*/%%'`
  27.  
  28. # Constants.
  29. PROGRAM=ltmain.sh
  30. PACKAGE=libtool
  31. VERSION=1.0
  32.  
  33. default_mode=
  34. help="Try \`$progname --help' for more information."
  35. magic="%%%MAGIC variable%%%"
  36. mkdir="mkdir"
  37. mv="mv -f"
  38. objdir=.libs
  39. rm="rm -f"
  40.  
  41. if test "$LTCONFIG_VERSION" != "$VERSION"; then
  42.   echo "$progname: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
  43.   echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
  44.   exit 1
  45. fi
  46.  
  47. #
  48. if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
  49.   echo "$progname: not configured to build any kind of library" 1>&2
  50.   echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
  51.   exit 1
  52. fi
  53.  
  54. # Global variables.
  55. mode=$default_mode
  56. nonopt=
  57. prev=
  58. prevopt=
  59. run=
  60. show=echo
  61. show_help=
  62.  
  63. # Parse our command line options once, thoroughly.
  64. while test $# -gt 0
  65. do
  66.   arg="$1"
  67.   shift
  68.  
  69.   case "$arg" in
  70.   -*=*) optarg=`echo "$arg" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  71.   *) optarg= ;;
  72.   esac
  73.  
  74.   # If the previous option needs an argument, assign it.
  75.   if test -n "$prev"; then
  76.     eval "$prev=\$arg"
  77.     prev=
  78.     prevopt=
  79.     continue
  80.   fi
  81.  
  82.   # Have we seen a non-optional argument yet?
  83.   case "$arg" in
  84.   --help)
  85.     show_help=yes
  86.     ;;
  87.  
  88.   --version)
  89.     echo "$PROGRAM (GNU $PACKAGE) $VERSION"
  90.     exit 0
  91.     ;;
  92.  
  93.   --dry-run | -n)
  94.     run=:
  95.     ;;
  96.  
  97.   --features)
  98.     echo "host: $host"
  99.     if test "$build_libtool_libs" = yes; then
  100.       echo "enable shared libraries"
  101.     else
  102.       echo "disable shared libraries"
  103.     fi
  104.     if test "$build_old_libs" = yes; then
  105.       echo "enable static libraries"
  106.     else
  107.       echo "disable static libraries"
  108.     fi
  109.     exit 0
  110.     ;;
  111.  
  112.   --finish) mode="finish" ;;
  113.  
  114.   --mode) prevopt="--mode" prev=mode ;;
  115.   --mode=*) mode="$optarg" ;;
  116.  
  117.   -*)
  118.     echo "$progname: unrecognized option \`$arg'" 1>&2
  119.     echo "$help" 1>&2
  120.     exit 1
  121.     ;;
  122.  
  123.   *)
  124.     nonopt="$arg"
  125.     break
  126.     ;;
  127.   esac
  128. done
  129.  
  130.  
  131. if test -n "$prevopt"; then
  132.   echo "$progname: option \`$prevopt' requires an argument" 1>&2
  133.   echo "$help" 1>&2
  134.   exit 1
  135. fi
  136.  
  137.  
  138. if test -z "$show_help"; then
  139.  
  140.   # Infer the operation mode.
  141.   if test -z "$mode"; then
  142.     case "$nonopt" in
  143.     *cc)
  144.       mode=link
  145.       for arg
  146.       do
  147.         case "$arg" in
  148.         -c)
  149.            mode=compile
  150.            break
  151.            ;;
  152.         esac
  153.       done
  154.       ;;
  155.     *install*|cp)
  156.       mode=install
  157.       ;;
  158.     *rm)
  159.       mode=uninstall
  160.       ;;
  161.     *.la)
  162.       mode=dlname
  163.       ;;
  164.     *)
  165.       # Just use the default operation mode.
  166.       if test -z "$mode"; then
  167.     if test -n "$nonopt"; then
  168.       echo "$progname: warning: cannot infer operation mode from \`$nonopt'" 1>&2
  169.     else
  170.       echo "$progname: warning: cannot infer operation mode without MODE-ARGS" 1>&2
  171.     fi
  172.       fi
  173.       ;;
  174.     esac
  175.   fi
  176.  
  177.   # Change the help message to a mode-specific one.
  178.   generic_help="$help"
  179.   help="Try \`$progname --help --mode=$mode' for more information."
  180.  
  181.   # These modes are in order of execution frequency so that they run quickly.
  182.   case "$mode" in
  183.   # libtool compile mode
  184.   compile)
  185.     progname="$progname: compile"
  186.     # Get the compilation command and the source file.
  187.     base_compile="$nonopt"
  188.     lastarg=
  189.     srcfile=
  190.  
  191.     for arg
  192.     do
  193.       # Quote any args containing shell metacharacters.
  194.       case "$arg" in
  195.       *" "*|*"    "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*|*\"*)
  196.      quote_arg="'$arg'" ;;
  197.       *) quote_arg="$arg" ;;
  198.       esac
  199.  
  200.       base_compile="$base_compile$lastarg"
  201.       srcfile="$quote_arg"
  202.       lastarg=" $srcfile"
  203.     done
  204.  
  205.     # Get the name of the library object.
  206.     libobj=`echo "$srcfile" | sed -e 's%^.*/%%'`
  207.  
  208.     # Recognize several different file suffixes.
  209.     xform='[cCFSf]'
  210.     case "$libobj" in
  211.     *.c++) xform='c++' ;;
  212.     *.cc) xform=cc ;;
  213.     *.cpp) xform=cpp ;;
  214.     *.cxx) xform=cxx ;;
  215.     *.f90) xform=f90 ;;
  216.     *.for) xform='for' ;;
  217.     esac
  218.  
  219.     libobj=`echo "$libobj" | sed -e "s/\.$xform$/.lo/"`
  220.  
  221.     case "$libobj" in
  222.     *.lo) obj=`echo "$libobj" | sed -e 's/\.lo$/.o/'` ;;
  223.     *)
  224.       echo "$progname: cannot determine name of library object from \`$srcfile'" 1>&2
  225.       exit 1
  226.       ;;
  227.     esac
  228.  
  229.     if test -z "$base_compile"; then
  230.       echo "$progname: you must specify a compilation command" 1>&2
  231.       echo "$help" 1>&2
  232.       exit 1
  233.     fi
  234.  
  235.     # Delete any leftover library objects.
  236.     if test "$build_old_libs" = yes; then
  237.       $run $rm $obj $libobj
  238.       trap "$run $rm $obj $libobj; exit 1" 1 2 15
  239.     else
  240.       $run $rm $libobj
  241.       trap "$run $rm $libobj; exit 1" 1 2 15
  242.     fi
  243.  
  244.     # Only build a PIC object if we are building libtool libraries.
  245.     if test "$build_libtool_libs" = yes; then
  246.       # All platforms use -DPIC, to notify preprocessed assembler code.
  247.       $show "$base_compile$pic_flag -DPIC $srcfile"
  248.       if $run eval "$base_compile$pic_flag -DPIC $srcfile"; then :
  249.       else
  250.     test -n "$obj" && $run $rm $obj
  251.     exit 1
  252.       fi
  253.  
  254.       # If we have no pic_flag, then copy the object into place and finish.
  255.       if test -z "$pic_flag"; then
  256.     $show "$LN_S $obj $libobj"
  257.     $run $LN_S $obj $libobj
  258.     exit $?
  259.       fi
  260.  
  261.       # Just move the object, then go on to compile the next one
  262.       $show "$mv $obj $libobj"
  263.       $run $mv $obj $libobj || exit 1
  264.     fi
  265.  
  266.     # Only build a position-dependent object if we build old libraries.
  267.     if test "$build_old_libs" = yes; then
  268.       $show "$base_compile $srcfile"
  269.       if $run eval "$base_compile $srcfile"; then :
  270.       else
  271.         $run $rm $obj $libobj
  272.         exit 1
  273.       fi
  274.     fi
  275.  
  276.     # Create an invalid libtool object if no PIC, so that we don't accidentally
  277.     # link it into a program.
  278.     if test "$build_libtool_libs" != yes; then
  279.       $show "echo timestamp > $libobj"
  280.       $run eval "echo timestamp > $libobj" || exit $?
  281.     fi
  282.  
  283.     exit 0
  284.     ;;
  285.  
  286.   # libtool link mode
  287.   link)
  288.     progname="$progname: link"
  289.     # Go through the arguments, transforming them on the way.
  290.     cc="$nonopt"
  291.     args="$cc"
  292.     allow_undefined=no
  293.     compile_command="$cc"
  294.     finalize_command="$cc"
  295.     compile_shlibpath=
  296.     finalize_shlibpath=
  297.     deplibs=
  298.     export_dynamic=no
  299.     hardcode_libdirs=
  300.     install_libdir=
  301.     libobjs=
  302.     link_against_libtool_libs=
  303.     link_static=
  304.     ltlibs=
  305.     objs=
  306.     prev=
  307.     prevarg=
  308.     perm_rpath=
  309.     temp_rpath=
  310.     vinfo=
  311.  
  312.     # We need to know -static, to get the right output filenames.
  313.     for arg
  314.     do
  315.       case "$arg" in
  316.       -static)
  317.         build_libtool_libs=no
  318.         build_old_libs=yes
  319.         break
  320.         ;;
  321.       esac
  322.     done
  323.  
  324.     for arg
  325.     do
  326.       # If the previous option needs an argument, assign it.
  327.       if test -n "$prev"; then
  328.     case "$prev" in
  329.     output)
  330.       compile_command="$compile_command @OUTPUT@"
  331.       finalize_command="$finalize_command @OUTPUT@"
  332.       args="$args $arg"
  333.       ;;
  334.     esac
  335.  
  336.     eval "$prev=\$arg"
  337.     prev=
  338.  
  339.     continue
  340.       fi
  341.  
  342.       args="$args $arg"
  343.       prevarg="$arg"
  344.  
  345.       case "$arg" in
  346.       -allow-undefined) allow_undefined=yes ;;
  347.  
  348.       -export-dynamic)
  349.     export_dynamic=yes
  350.     compile_command="$compile_command $export_dynamic_flag"
  351.     finalize_command="$finalize_command $export_dynamic_flag"
  352.     continue
  353.     ;;
  354.  
  355.       -L*)
  356.     dir=`echo "$arg" | sed 's%^-L\(.*\)$%\1%'`
  357.     case "$dir" in
  358.     /*)
  359.       ;;
  360.     *)
  361.       echo "$progname: \`-L$dir' cannot specify a relative directory" 1>&2
  362.       exit 1
  363.       ;;
  364.     esac
  365.     deplibs="$deplibs $arg"
  366.     ;;
  367.  
  368.       -l*) deplibs="$deplibs $arg" ;;
  369.  
  370.       -o) prev=output ;;
  371.  
  372.       -rpath)
  373.     prev=install_libdir
  374.     continue
  375.     ;;
  376.  
  377.       -static)
  378.     link_static="`eval echo \"$link_static_flag\"`"
  379.     compile_command="$compile_command $link_static"
  380.     continue
  381.     ;;
  382.  
  383.       -version-file)
  384.     echo "$progname: \`-version-file' has been replaced by \`-version-info'" 1>&2
  385.     echo "$help" 1>&2
  386.     exit 1
  387.     ;;
  388.  
  389.       -version-info)
  390.     prev=vinfo
  391.     continue
  392.     ;;
  393.  
  394.       -*) cc="$cc $arg" ;; # Some other compiler flag.
  395.  
  396.       *.o)
  397.     # A standard object.
  398.     objs="$objs $arg"
  399.     ;;
  400.  
  401.       *.a)
  402.     # Find the relevant object directory and library name.
  403.     file=`echo "$arg" | sed 's%^.*/%%'`
  404.     dir=`echo "$arg" | sed 's%/[^/]*$%/%'`
  405.     test "$dir" = "$arg" && dir=
  406.  
  407.     # Standard archive.
  408.     objs="$objs $arg"
  409.     ;;
  410.  
  411.       *.lo)
  412.     # A library object.
  413.     libobjs="$libobjs $arg"
  414.     ;;
  415.  
  416.       *.la)
  417.     # A libtool-controlled library.
  418.  
  419.     libdir=
  420.     library_names=
  421.     old_library=
  422.  
  423.     # Check to see that this really is a libtool archive.
  424.     if egrep "^# Generated by $PROGRAM" $arg >/dev/null 2>&1; then :
  425.     else
  426.       echo "$progname: \`$arg' is not a valid libtool archive" 1>&2
  427.       exit 1
  428.     fi
  429.  
  430.     # If there is no directory component, then add one.
  431.     case "$arg" in
  432.     */*) . $arg ;;
  433.     *) . ./$arg ;;
  434.     esac
  435.  
  436.     if test -z "$libdir"; then
  437.       echo "$progname: \`$arg' contains no -rpath information" 1>&2
  438.       exit 1
  439.     fi
  440.  
  441.     # Get the name of the library we link against.
  442.     linklib=
  443.     for l in $old_library $library_names; do
  444.       linklib="$l"
  445.     done
  446.  
  447.     if test -z "$linklib"; then
  448.       echo "$progname: cannot find name of link library for \`$arg'" 1>&2
  449.       exit 1
  450.     fi
  451.  
  452.     # Find the relevant object directory and library name.
  453.     name=`echo "$arg" | sed 's%^.*/%%; s/\.la$//; s/^lib//'`
  454.     dir=`echo "$arg" | sed 's%/[^/]*$%%'`
  455.     if test "$dir" = "$arg"; then
  456.       dir="$objdir"
  457.     else
  458.       dir="$dir/$objdir"
  459.     fi
  460.  
  461.     if test "$build_libtool_libs" = yes && test -n "$library_names"; then
  462.       link_against_libtool_libs="$link_against_libtool_libs $arg"
  463.       if test -n "$shlibpath_var"; then
  464.         # Make sure the rpath contains only unique directories.
  465.         case "$temp_rpath " in
  466.         "* $dir *") ;;
  467.         *) temp_rpath="$temp_rpath $dir" ;;
  468.         esac
  469.       fi
  470.  
  471.       if test -n "$hardcode_libdir_flag_spec"; then
  472.         if test -n "$hardcode_libdir_separator"; then
  473.           if test -z "$hardcode_libdirs"; then
  474.         # Put the magic libdir with the hardcode flag.
  475.         hardcode_libdirs="$libdir"
  476.         libdir="@HARDCODE_LIBDIRS@"
  477.           else
  478.         # Just accumulate the libdirs.
  479.         hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  480.         libdir=
  481.           fi
  482.         fi
  483.  
  484.         if test -n "$libdir"; then
  485.           hardcode_libdir_flag=`eval echo \"$hardcode_libdir_flag_spec\"`
  486.           compile_command="$compile_command $hardcode_libdir_flag"
  487.           finalize_command="$finalize_command $hardcode_libdir_flag"
  488.         fi
  489.       elif test "$hardcode_runpath_var" = yes; then
  490.         # Do the same for the permanent run path.
  491.         case "$perm_rpath " in
  492.         "* $libdir *") ;;
  493.         *) perm_rpath="$perm_rpath $libdir" ;;
  494.         esac
  495.       fi
  496.  
  497.  
  498.       case "$hardcode_action" in
  499.       immediate)
  500.         if test "$hardcode_direct" = no; then
  501.           compile_command="$compile_command $dir/$linklib"
  502.         elif test "$hardcode_minus_L" = no; then
  503.           compile_command="$compile_command -L$dir -l$name"
  504.         elif test "$hardcode_shlibpath_var" = no; then
  505.           compile_shlibpath="$compile_shlibpath$dir:"
  506.           compile_command="$compile_command -l$name"
  507.         fi
  508.         ;;
  509.  
  510.       relink)
  511.         # We need an absolute path.
  512.         case "$dir" in
  513.         /*) ;;
  514.         *)
  515.           absdir=`cd "$dir" && pwd`
  516.           if test -z "$absdir"; then
  517.         echo "$progname: cannot determine absolute directory name of \`$dir'" 1>&2
  518.         exit 1
  519.           fi
  520.           dir="$absdir"
  521.           ;;
  522.         esac
  523.  
  524.         if test "$hardcode_direct" = yes; then
  525.           compile_command="$compile_command $dir/$linklib"
  526.         elif test "$hardcode_minus_L" = yes; then
  527.           compile_command="$compile_command -L$dir -l$name"
  528.         elif test "$hardcode_shlibpath_var" = yes; then
  529.           compile_shlibpath="$compile_shlibpath$dir:"
  530.           compile_command="$compile_command -l$name"
  531.         fi
  532.         ;;
  533.  
  534.       *)
  535.         echo "$progname: \`$hardcode_action' is an unknown hardcode action" 1>&2
  536.         exit 1
  537.         ;;
  538.       esac
  539.  
  540.       # Finalize command for both is simple: just hardcode it.
  541.       if test "$hardcode_direct" = yes; then
  542.         finalize_command="$finalize_command $libdir/$linklib"
  543.       elif test "$hardcode_minus_L" = yes; then
  544.         finalize_command="$finalize_command -L$libdir -l$name"
  545.       elif test "$hardcode_shlibpath_var" = yes; then
  546.         finalize_shlibpath="$finalize_shlibpath$libdir:"
  547.         finalize_command="$finalize_command -l$name"
  548.           else
  549.             # We can't seem to hardcode it, guess we'll fake it.
  550.         finalize_command="$finalize_command -L$libdir -l$name"
  551.       fi
  552.         else
  553.           # Transform directly to old archives if we don't build new libraries.
  554.           if test -n "$pic_flag" && test -z "$old_library"; then
  555.             echo "$progname: cannot find static library for \`$arg'" 1>&2
  556.         exit 1
  557.       fi
  558.       test -n "$old_library" && linklib="$old_library"
  559.           compile_command="$compile_command $dir/$linklib"
  560.       finalize_command="$finalize_command $dir/$linklib"
  561.         fi
  562.     continue
  563.     ;;
  564.  
  565.       *)
  566.         echo "$progname: unknown file suffix for \`$arg'" 1>&2
  567.     echo "$help" 1>&2
  568.     exit 1
  569.     ;;
  570.       esac
  571.  
  572.       compile_command="$compile_command $arg"
  573.       finalize_command="$finalize_command $arg"
  574.     done
  575.  
  576.     if test -n "$prev"; then
  577.       echo "$progname: the \`$prevarg' option requires an argument" 1>&2
  578.       echo "$help" 1>&2
  579.       exit 1
  580.     fi
  581.  
  582.     # Substitute the hardcoded libdirs into the compile commands.
  583.     if test "$hardcode_libdir_colon_separated" = yes; then
  584.       compile_command=`echo "$compile_command" | sed "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
  585.       finalize_command=`echo "$finalize_command" | sed "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
  586.     fi
  587.  
  588.     oldlib=
  589.     oldobjs=
  590.     case "$output" in
  591.     "")
  592.       echo "$progname: you must specify an output file" 1>&2
  593.       echo "$help" 1>&2
  594.       exit 1
  595.       ;;
  596.  
  597.     */*)
  598.       echo "$progname: output file \`$output' must have no directory components" 1>&2
  599.       exit 1
  600.       ;;
  601.  
  602.     *.la)
  603.       libname=`echo "$output" | sed 's/\.la$//'`
  604.  
  605.       # All the library-specific variables (install_libdir is set above).
  606.       library_names=
  607.       old_library=
  608.       dlname=
  609.       current=0
  610.       revision=0
  611.       age=0
  612.  
  613.       if test -n "$objs"; then
  614.     echo "$progname: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
  615.     exit 1
  616.       fi
  617.  
  618.       # How the heck are we supposed to write a wrapper for a shared library?
  619.       if test -n "$link_against_libtool_libs"; then
  620.         echo "$progname: libtool library \`$output' may not depend on uninstalled libraries:$link_against_libtool_libs" 1>&2
  621.     exit 1
  622.       fi
  623.  
  624.       if test -z "$install_libdir"; then
  625.     echo "$progname: you must specify an installation directory with \`-rpath'" 1>&2
  626.     exit 1
  627.       fi
  628.  
  629.       # Parse the version information argument.
  630.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS=':'
  631.       set dummy $vinfo
  632.       IFS="$save_ifs"
  633.  
  634.       if test -n "$5"; then
  635.         echo "$progname: too many parameters to \`-version-info'" 1>&2
  636.     echo "$help" 1>&2
  637.     exit 1
  638.       fi
  639.  
  640.       test -n "$2" && current="$2"
  641.       test -n "$3" && revision="$3"
  642.       test -n "$4" && age="$4"
  643.  
  644.       # Check that each of the things are valid numbers.
  645.       case "$current" in
  646.       0 | [1-9] | [1-9][0-9]*) ;;
  647.       *)
  648.     echo "$progname: CURRENT \`$current' is not a nonnegative integer" 1>&2
  649.         echo "$progname: \`$vinfo' is not valid version information" 1>&2
  650.         exit 1
  651.     ;;
  652.       esac
  653.  
  654.       case "$revision" in
  655.       0 | [1-9] | [1-9][0-9]*) ;;
  656.       *)
  657.     echo "$progname: REVISION \`$revision' is not a nonnegative integer" 1>&2
  658.         echo "$progname: \`$vinfo' is not valid version information" 1>&2
  659.         exit 1
  660.     ;;
  661.       esac
  662.  
  663.       case "$age" in
  664.       0 | [1-9] | [1-9][0-9]*) ;;
  665.       *)
  666.     echo "$progname: AGE \`$age' is not a nonnegative integer" 1>&2
  667.         echo "$progname: \`$vinfo' is not valid version information" 1>&2
  668.         exit 1
  669.     ;;
  670.       esac
  671.  
  672.       if test $age -gt $current; then
  673.         echo "$progname: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
  674.         echo "$progname: \`$vinfo' is not valid version information" 1>&2
  675.         exit 1
  676.       fi
  677.  
  678.       # Calculate the version variables.
  679.       version_vars="version_type current age revision"
  680.       case "$version_type" in
  681.       none) ;;
  682.  
  683.       linux)
  684.     version_vars="$version_vars major versuffix"
  685.     major=`expr $current - $age`
  686.     versuffix="$major.$age.$revision"
  687.     ;;
  688.  
  689.       osf)
  690.     version_vars="$version_vars versuffix verstring"
  691.     major=`expr $current - $age`
  692.     versuffix="$current.$age.$revision"
  693.     verstring="$versuffix"
  694.  
  695.     # Add in all the interfaces that we are compatible with.
  696.     loop=$age
  697.     while test $loop != 0; do
  698.       iface=`expr $current - $loop`
  699.       loop=`expr $loop - 1`
  700.       verstring="$verstring:${iface}.0"
  701.     done
  702.  
  703.     # Make executables depend on our current version.
  704.     verstring="$verstring:${current}.0"
  705.     ;;
  706.  
  707.       sunos)
  708.     version_vars="$version_vars major versuffix"
  709.     major="$current"
  710.     versuffix="$current.$revision"
  711.     ;;
  712.  
  713.       *)
  714.     echo "$progname: unknown library version type \`$version_type'" 1>&2
  715.     echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
  716.     exit 1
  717.     ;;
  718.       esac
  719.  
  720.       # Create the output directory, or remove our outputs if we need to.
  721.       if test -d $objdir; then
  722.         $show "$rm $objdir/$libname.*"
  723.         $run $rm $objdir/$libname.*
  724.       else
  725.         $show "$mkdir $objdir"
  726.     $run $mkdir $objdir || exit $?
  727.       fi
  728.  
  729.       # Check to see if the archive will have undefined symbols.
  730.       if test "$allow_undefined" = yes; then
  731.     if test "$allow_undefined_flag" = unsupported; then
  732.       echo "$progname: warning: undefined symbols not allowed in $host shared libraries" 1>&2
  733.       build_libtool_libs=no
  734.     fi
  735.       else
  736.     # Clear the flag.
  737.     allow_undefined_flag=
  738.       fi
  739.  
  740.       if test "$build_libtool_libs" = yes; then
  741.     # Get the real and link names of the library.
  742.     library_names=`eval echo \"$library_names_spec\"`
  743.     set dummy $library_names
  744.     realname="$2"
  745.     shift; shift
  746.  
  747.     if test -n "$soname_spec"; then
  748.       soname=`eval echo \"$soname_spec\"`
  749.     else
  750.       soname="$realname"
  751.     fi
  752.  
  753.     lib="$objdir/$realname"
  754.     linknames=
  755.     for link
  756.     do
  757.       linknames="$linknames $link"
  758.     done
  759.  
  760.     # Use standard objects if they are PIC.
  761.     test -z "$pic_flag" && libobjs=`echo "$libobjs " | sed 's/\.lo /.o /g; s/ $//g'`
  762.  
  763.     # Do each of the archive commands.
  764.     cmds=`eval echo \"$archive_cmds\"`
  765.     IFS="${IFS=     }"; save_ifs="$IFS"; IFS=';'
  766.     for cmd in $cmds; do
  767.       IFS="$save_ifs"
  768.       $show "$cmd"
  769.       $run eval "$cmd" || exit $?
  770.     done
  771.     IFS="$save_ifs"
  772.  
  773.     # Create links to the real library.
  774.     for link in $linknames; do
  775.       $show "(cd $objdir && $LN_S $realname $link)"
  776.       $run eval "(cd $objdir && $LN_S $realname $link)" || exit $?
  777.     done
  778.  
  779.     # If -export-dynamic was specified, set the dlname.
  780.     if test "$export_dynamic" = yes; then
  781.       # On all known operating systems, these are identical.
  782.       dlname="$soname"
  783.     fi
  784.       fi
  785.       ;;
  786.  
  787.     *.lo | *.o)
  788.       if test -n "$link_against_libtool_libs"; then
  789.     echo "$progname: error: cannot link libtool libraries into reloadable objects" 1>&2
  790.     exit 1
  791.       fi
  792.  
  793.       if test -n "$deplibs"; then
  794.     echo "$progname: warning: \`-l' and \`-L' are ignored while creating objects" 1>&2
  795.       fi
  796.  
  797.       if test -n "$install_libdir"; then
  798.         echo "$progname: warning: \`-rpath' is ignored while creating objects" 1>&2
  799.       fi
  800.  
  801.       if test -n "$vinfo"; then
  802.     echo "$progname: warning: \`-version-info' is ignored while creating objects" 1>&2
  803.       fi
  804.  
  805.       case "$output" in
  806.       *.lo)
  807.     if test -n "$objs"; then
  808.       echo "$progname: cannot build library object \`$output' from non-libtool objects" 1>&2
  809.       exit 1
  810.     fi
  811.     libobj="$output"
  812.     obj=`echo "$output" | sed 's/\.lo$/.o/'`
  813.     ;;
  814.       *)
  815.         libobj=
  816.     obj="$output"
  817.     ;;
  818.       esac
  819.  
  820.       # Delete the old objects.
  821.       $run $rm $obj $libobj
  822.  
  823.       # Create the old-style object.
  824.       reload_objs="$objs"`echo "$libobjs " | sed 's/[^     ]*\.a //g; s/\.lo /.o /g; s/ $//g'`
  825.  
  826.       output="$obj"
  827.       cmds=`eval echo \"$reload_cmds\"`
  828.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS=';'
  829.       for cmd in $cmds; do
  830.         IFS="$save_ifs"
  831.         $show "$cmd"
  832.     $run eval "$cmd" || exit $?
  833.       done
  834.       IFS="$save_ifs"
  835.  
  836.       # Exit if we aren't doing a library object file.
  837.       test -z "$libobj" && exit 0
  838.  
  839.       if test "$build_libtool_libs" != yes; then
  840.         # Create an invalid libtool object if no PIC, so that we don't
  841.         # accidentally link it into a program.
  842.     $show "echo timestamp > $libobj"
  843.     $run eval "echo timestamp > $libobj" || exit $?
  844.     exit 0
  845.       fi
  846.  
  847.       if test -n "$pic_flag"; then
  848.     # Only do commands if we really have different PIC objects.
  849.     reload_objs="$libobjs"
  850.     output="$libobj"
  851.         cmds=`eval echo \"$reload_cmds\"`
  852.         IFS="${IFS=     }"; save_ifs="$IFS"; IFS=';'
  853.         for cmd in $cmds; do
  854.           IFS="$save_ifs"
  855.           $show "$cmd"
  856.           $run eval "$cmd" || exit $?
  857.         done
  858.         IFS="$save_ifs"
  859.       else
  860.         # Just create a symlink.
  861.         $show "$LN_S $obj $libobj"
  862.         $run $LN_S $obj $libobj || exit 1
  863.       fi
  864.  
  865.       exit 0
  866.       ;;
  867.  
  868.     *)
  869.       if test -n "$install_libdir"; then
  870.         echo "$progname: warning: \`-rpath' is ignored while linking programs" 1>&2
  871.       fi
  872.  
  873.       if test -n "$vinfo"; then
  874.     echo "$progname: warning: \`-version-info' is ignored while linking programs" 1>&2
  875.       fi
  876.  
  877.       if test -n "$libobjs"; then
  878.     # Transform all the library objects into standard objects.
  879.     compile_command=`echo "$compile_command " | sed 's/\.lo /.o /g; s/ $//'`
  880.     finalize_command=`echo "$finalize_command " | sed 's/\.lo /.o /g; s/ $//'`
  881.       fi
  882.  
  883.       if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
  884.     # Replace the output file specification.
  885.     compile_command=`echo "$compile_command" | sed 's%@OUTPUT@%'"$output"'%g'`
  886.     finalize_command=`echo "$finalize_command" | sed 's%@OUTPUT@%'"$output"'%g'`
  887.  
  888.     # We have no uninstalled library dependencies, so finalize right now.
  889.     $show "$compile_command"
  890.     $run $compile_command
  891.     status=$?
  892.  
  893.     # If we failed to link statically, then try again.
  894.     if test $status -ne 0 && test -n "$link_static"; then
  895.       echo "$progname: cannot link \`$output' statically; retrying semi-dynamically" 1>&2
  896.       compile_command=`echo "$compile_command " | sed "s% $link_static % %;s/ $//"`
  897.       $show "$finalize_command"
  898.       $run $finalize_command
  899.       status=$?
  900.     fi
  901.     exit $status
  902.       fi
  903.  
  904.       # Replace the output file specification.
  905.       compile_command=`echo "$compile_command" | sed 's%@OUTPUT@%'"$objdir/$output"'%g'`
  906.       finalize_command=`echo "$finalize_command" | sed 's%@OUTPUT@%'"$objdir/$output"'T%g'`
  907.  
  908.       # Create the binary in the object directory, then wrap it.
  909.       if test -d $objdir; then :
  910.       else
  911.         $show "$mkdir $objdir"
  912.         $run $mkdir $objdir || exit $?
  913.       fi
  914.  
  915.       if test -n "$shlibpath_var"; then
  916.         # We should set the shlibpath_var
  917.     rpath=
  918.     for dir in $temp_rpath; do
  919.       case "$dir" in
  920.       /*)
  921.         # Absolute path.
  922.         rpath="$rpath$dir:"
  923.         ;;
  924.       *)
  925.         # Relative path: add a thisdir entry.
  926.         rpath="$rpath\$thisdir/$dir:"
  927.         ;;
  928.       esac
  929.     done
  930.     temp_rpath="$rpath"
  931.       fi
  932.  
  933.       # Delete the old output file.
  934.       $run $rm $output
  935.  
  936.       if test -n "$compile_shlibpath"; then
  937.     compile_command="$shlibpath_var=\"$compile_shlibpath\$$shlibpath_var\" $compile_command"
  938.       fi
  939.       if test -n "$finalize_shlibpath"; then
  940.     finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  941.       fi
  942.  
  943.       if test -n "$perm_rpath"; then
  944.     # We should set the runpath_var.
  945.     rpath=
  946.     for dir in $perm_rpath; do
  947.       rpath="$rpath$dir:"
  948.     done
  949.     compile_command="$runpath_var=\"$rpath\$$runpath_var\" $compile_command"
  950.     finalize_command="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command"
  951.       fi
  952.  
  953.       case "$hardcode_action" in
  954.       relink)
  955.     # AGH! Flame the AIX and HP-UX people for me, will ya?
  956.     echo "$progname: warning: using a buggy system linker" 1>&2
  957.     echo "$progname: relinking will be required before \`$output' can be installed" 1>&2
  958.     ;;
  959.       esac
  960.  
  961.       $show "$compile_command"
  962.       $run eval "$compile_command" || exit $?
  963.  
  964.       # Now create the wrapper script.
  965.       echo "creating $output"
  966.  
  967.       # Only actually do things if our run command is non-null.
  968.       if test -z "$run"; then
  969.     $rm $output
  970.     trap "$rm $output; exit 1" 1 2 15
  971.  
  972.     cat > $output <<EOF
  973. #! /bin/sh
  974.  
  975. # $output - temporary wrapper script for $objdir/$output
  976. # Generated by $PROGRAM - GNU $PACKAGE $VERSION
  977. #
  978. # The $output program cannot be directly executed until all the libtool
  979. # libraries that it depends on are installed.
  980. #
  981. # This wrapper script should never be moved out of \``pwd`'.
  982. # If it is, it will not operate correctly.
  983.  
  984. # This environment variable determines our operation mode.
  985. if test "\$libtool_install_magic" = "$magic"; then
  986.   # install mode needs the following variables:
  987.   link_against_libtool_libs='$link_against_libtool_libs'
  988.   finalize_command='$finalize_command'
  989. else
  990.   program="$output"
  991.  
  992.   # Find the directory that this script lives in.
  993.   thisdir=\`echo \$0 | sed 's%/[^/]*$%%'\`
  994.   zerodir="\$thisdir"
  995.   test "x\$thisdir" = "x\$0" && thisdir=.
  996.  
  997.   # Try to get the absolute directory name.
  998.   absdir=\`cd "\$thisdir" && pwd\`
  999.   test -n "\$absdir" && thisdir="\$absdir"
  1000.  
  1001.   # If \$0 failed (due to symlink?), try hardcoded path.
  1002.   if test ! -f "\$thisdir/$objdir/\$program"; then
  1003.       thisdir="`pwd`"
  1004.   fi
  1005.  
  1006.   progdir="\$thisdir/$objdir"
  1007.  
  1008.   if test -f "\$progdir/\$program"; then
  1009.     # Run the actual program with our arguments.
  1010.     args=
  1011.     for arg
  1012.     do
  1013.       # Quote arguments (to preserve shell metacharacters).
  1014.       args="\$args '\$arg'"
  1015.     done
  1016.  
  1017.     # Export the path to the program.
  1018.     PATH="\$progdir:\$PATH"
  1019.     export PATH
  1020. EOF
  1021.  
  1022.     # Export our shlibpath_var if we have one.
  1023.     if test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  1024.       cat >> $output <<EOF
  1025.  
  1026.     # Add our own library path to $shlibpath_var
  1027.     $shlibpath_var="$temp_rpath\$$shlibpath_var"
  1028.  
  1029.     # Some systems cannot cope with colon-terminated $shlibpath_var
  1030.     $shlibpath_var=\`echo \$$shlibpath_var | sed -e 's/:*\$//'\`
  1031.  
  1032.     export $shlibpath_var
  1033. EOF
  1034.     fi
  1035.  
  1036.         cat >> $output <<EOF
  1037.  
  1038.     eval "exec \$program \$args"
  1039.  
  1040.     echo "\$0: cannot exec \$program \$args"
  1041.     exit 1
  1042.   else
  1043.     # The program doesn't exist.
  1044.     echo "\$0: error: neither \$zerodir/$objdir/\$program" 1>&2
  1045.     echo "nor \$progdir/\$program exists." 1>&2
  1046.     echo "This script is just a wrapper for \$program, and cannot" 1>&2
  1047.     echo "be moved far from its original directory without breaking." 1>&2
  1048.     echo "See the $PACKAGE documentation for more information." 1>&2
  1049.     exit 1
  1050.   fi
  1051. fi
  1052. EOF
  1053.     chmod +x $output
  1054.       fi
  1055.       exit 0
  1056.       ;;
  1057.     esac
  1058.  
  1059.  
  1060.     # See if we need to build an old-fashioned archive.
  1061.     if test "$build_old_libs" = "yes"; then
  1062.       # Now set the variables for building old libraries.
  1063.       oldlib="$objdir/$libname.a"
  1064.  
  1065.       # Transform .lo files to .o files.
  1066.       oldobjs="$objs"`echo "$libobjs " | sed 's/[^     ]*\.a //g; s/\.lo /.o /g; s/ $//g'`
  1067.  
  1068.       if test -d "$objdir"; then
  1069.     $show "$rm $oldlib"
  1070.     $run $rm $oldlib
  1071.       else
  1072.     $show "$mkdir $objdir"
  1073.     $run $mkdir $objdir
  1074.       fi
  1075.  
  1076.       # Do each command in the archive commands.
  1077.       cmds=`eval echo \"$old_archive_cmds\"`
  1078.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS=';'
  1079.       for cmd in $cmds; do
  1080.         IFS="$save_ifs"
  1081.         $show "$cmd"
  1082.     $run eval "$cmd" || exit $?
  1083.       done
  1084.       IFS="$save_ifs"
  1085.     fi
  1086.  
  1087.     # Now create the libtool archive.
  1088.     case "$output" in
  1089.     *.la)
  1090.       old_library=
  1091.       test "$build_old_libs" = yes && old_library="$libname.a"
  1092.  
  1093.       echo "creating $output"
  1094.  
  1095.       # Only create the output if not a dry run.
  1096.       if test -z "$run"; then
  1097.     cat > $output <<EOF
  1098. # $output - a libtool library file
  1099. # Generated by $PROGRAM - GNU $PACKAGE $VERSION
  1100.  
  1101. # The name that we can dlopen(3).
  1102. dlname='$dlname'
  1103.  
  1104. # Names of this library.
  1105. library_names='$library_names'
  1106.  
  1107. # The name of the static archive.
  1108. old_library='$old_library'
  1109.  
  1110. # Version information for $libname.
  1111. current=$current
  1112. age=$age
  1113. revision=$revision
  1114.  
  1115. # Directory that this library needs to be installed in:
  1116. libdir='$install_libdir'
  1117. EOF
  1118.       fi
  1119.  
  1120.       # Do a symbolic link so that the libtool archive can be found in
  1121.       # LD_LIBRARY_PATH before the program is installed.
  1122.       $show "(cd $objdir && $LN_S ../$output $output)"
  1123.       $run eval "(cd $objdir && $LN_S ../$output $output)" || exit 1
  1124.       ;;
  1125.     esac
  1126.     exit 0
  1127.     ;;
  1128.  
  1129.   # libtool install mode
  1130.   install)
  1131.     progname="$progname: install"
  1132.  
  1133.     # The first argument is the name of the installation program.
  1134.     install_prog="$nonopt"
  1135.  
  1136.     # We need to accept at least all the BSD install flags.
  1137.     dest=
  1138.     files=
  1139.     opts=
  1140.     prev=
  1141.     install_type=
  1142.     isdir=
  1143.     stripme=
  1144.     for arg
  1145.     do
  1146.       if test -n "$dest"; then
  1147.         files="$files $dest"
  1148.     dest="$arg"
  1149.     continue
  1150.       fi
  1151.  
  1152.       case "$arg" in
  1153.       -d) isdir=yes ;;
  1154.       -f) prev="-f" ;;
  1155.       -g) prev="-g" ;;
  1156.       -m) prev="-m" ;;
  1157.       -o) prev="-o" ;;
  1158.       -s)
  1159.     stripme=" -s"
  1160.     continue
  1161.     ;;
  1162.       -*) ;;
  1163.  
  1164.       *)
  1165.     # If the previous option needed an argument, then skip it.
  1166.     if test -n "$prev"; then
  1167.       prev=
  1168.     else
  1169.       dest="$arg"
  1170.       continue
  1171.     fi
  1172.         ;;
  1173.       esac
  1174.       install_prog="$install_prog $arg"
  1175.     done
  1176.  
  1177.     if test -z "$install_prog"; then
  1178.       echo "$progname: you must specify an install program" 1>&2
  1179.       echo "$help" 1>&2
  1180.       exit 1
  1181.     fi
  1182.  
  1183.     if test -n "$prev"; then
  1184.       echo "$progname: the \`$prev' option requires an argument" 1>&2
  1185.       echo "$help" 1>&2
  1186.       exit 1
  1187.     fi
  1188.  
  1189.     if test -z "$files"; then
  1190.       if test -z "$dest"; then
  1191.         echo "$progname: no file or destination specified" 1>&2
  1192.       else
  1193.     echo "$progname: you must specify a destination" 1>&2
  1194.       fi
  1195.       echo "$help" 1>&2
  1196.       exit 1
  1197.     fi
  1198.  
  1199.     # Strip any trailing slash from the destination.
  1200.     dest=`echo "$dest" | sed 's%/$%%'`
  1201.  
  1202.     # Check to see that the destination is a directory.
  1203.     test -d "$dest" && isdir=yes
  1204.     if test -n "$isdir"; then
  1205.       destdir="$dest"
  1206.       destname=
  1207.     else
  1208.       destdir=`echo "$dest" | sed 's%/[^/]*$%%'`
  1209.       test "$destdir" = "$dest" && destdir=.
  1210.       destname=`echo "$dest" | sed 's%^.*/%%'`
  1211.  
  1212.       # Not a directory, so check to see that there is only one file specified.
  1213.       set dummy $files
  1214.       if test $# -gt 2; then
  1215.         echo "$progname: \`$dest' is not a directory" 1>&2
  1216.         echo "$help" 1>&2
  1217.     exit 1
  1218.       fi
  1219.     fi
  1220.     case "$destdir" in
  1221.     /*) ;;
  1222.     *)
  1223.       for file in $files; do
  1224.     case "$file" in
  1225.     *.lo) ;;
  1226.     *)
  1227.       echo "$progname: \`$destdir' must be an absolute directory name" 1>&2
  1228.       echo "$help" 1>&2
  1229.       exit 1
  1230.       ;;
  1231.     esac
  1232.       done
  1233.       ;;
  1234.     esac
  1235.  
  1236.     staticlibs=
  1237.     future_libdirs=
  1238.     current_libdirs=
  1239.     for file in $files; do
  1240.  
  1241.       # Do each installation.
  1242.       case "$file" in
  1243.       *.a)
  1244.     # Do the static libraries later.
  1245.     staticlibs="$staticlibs $file"
  1246.     ;;
  1247.  
  1248.       *.la)
  1249.     # Check to see that this really is a libtool archive.
  1250.     if egrep "^# Generated by $PROGRAM" $file >/dev/null 2>&1; then :
  1251.     else
  1252.       echo "$progname: \`$file' is not a valid libtool archive" 1>&2
  1253.       echo "$help" 1>&2
  1254.       exit 1
  1255.     fi
  1256.  
  1257.     library_names=
  1258.     old_library=
  1259.     # If there is no directory component, then add one.
  1260.     case "$file" in
  1261.     */*) . $file ;;
  1262.     *) . ./$file ;;
  1263.     esac
  1264.  
  1265.     # Add the libdir to current_libdirs if it is the destination.
  1266.     if test "$destdir" = "$libdir"; then
  1267.       case "$current_libdirs " in
  1268.       "* $libdir *") ;;
  1269.       *) current_libdirs="$current_libdirs $libdir" ;;
  1270.       esac
  1271.     else
  1272.       # Note the libdir as a future libdir.
  1273.       case "$future_libdirs " in
  1274.       "* $libdir *") ;;
  1275.       *) future_libdirs="$future_libdirs $libdir" ;;
  1276.       esac
  1277.     fi
  1278.  
  1279.     dir="`echo "$file" | sed 's%/[^/]*$%%'`/"
  1280.     test "$dir" = "$file/" && dir=
  1281.     dir="$dir$objdir"
  1282.  
  1283.     # See the names of the shared library.
  1284.     set dummy $library_names
  1285.     if test -n "$2"; then
  1286.       realname="$2"
  1287.       shift
  1288.       shift
  1289.  
  1290.       # Install the shared library and build the symlinks.
  1291.       $show "$install_prog $dir/$realname $destdir/$realname"
  1292.       $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
  1293.       test "X$dlname" = "X$realname" && dlname=
  1294.  
  1295.       # Support stripping libraries.
  1296.       if test -n "$stripme"; then
  1297.         if test -n "$striplib"; then
  1298.           $show "$striplib $destdir/$realname"
  1299.           $run $striplib $destdir/$realname || exit $?
  1300.         else
  1301.           echo "$progname: warning: no library stripping program" 1>&2
  1302.         fi
  1303.       fi
  1304.  
  1305.       if test $# -gt 0; then
  1306.         # Delete the old symlinks.
  1307.             rmcmd="$rm"
  1308.             for linkname
  1309.             do
  1310.               rmcmd="$rmcmd $destdir/$linkname"
  1311.             done
  1312.             $show "$rmcmd"
  1313.             $run $rmcmd
  1314.  
  1315.         # ... and create new ones.
  1316.         for linkname
  1317.         do
  1318.           test "X$dlname" = "X$linkname" && dlname=
  1319.           $show "(cd $destdir && $LN_S $realname $linkname)"
  1320.           $run eval "(cd $destdir && $LN_S $realname $linkname)"
  1321.         done
  1322.       fi
  1323.  
  1324.       if test -n "$dlname"; then
  1325.         # Install the dynamically-loadable library.
  1326.         $show "$install_prog $dir/$dlname $destdir/$dlname"
  1327.         $run eval "$install_prog $dir/$dlname $destdir/$dlname" || exit $?
  1328.       fi
  1329.  
  1330.       # Do each command in the postinstall commands.
  1331.       lib="$destdir/$realname"
  1332.       cmds=`eval echo \"$postinstall_cmds\"`
  1333.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS=';'
  1334.       for cmd in $cmds; do
  1335.         IFS="$save_ifs"
  1336.         $show "$cmd"
  1337.         $run eval "$cmd" || exit $?
  1338.       done
  1339.       IFS="$save_ifs"
  1340.     fi
  1341.  
  1342.     # Install the pseudo-library for information purposes.
  1343.     name=`echo "$file" | sed 's%^.*/%%'`
  1344.     $show "$install_prog $file $destdir/$name"
  1345.     $run $install_prog $file $destdir/$name || exit $?
  1346.  
  1347.     # Maybe install the static library, too.
  1348.     test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
  1349.     ;;
  1350.  
  1351.       *.lo)
  1352.         # Install (i.e. copy) a libtool object.
  1353.  
  1354.         # Figure out destination file name, if it wasn't already specified.
  1355.         if test -n "$destname"; then
  1356.       destfile="$destdir/$destname"
  1357.     else
  1358.       destfile=`echo "$file" | sed 's%^.*/%%;'`
  1359.       destfile="$destdir/$destfile"
  1360.         fi
  1361.  
  1362.     # Deduce the name of the destination old-style object file.
  1363.     case "$destfile" in
  1364.     *.lo)
  1365.       staticdest=`echo "$destfile" | sed 's/\.lo$/\.o/;'`
  1366.       ;;
  1367.     *.o)
  1368.       staticdest="$destfile"
  1369.       destfile=
  1370.       ;;
  1371.     *)
  1372.       echo "$progname: cannot copy a libtool object to \`$destfile'" 1>&2
  1373.       echo "$help" 1>&2
  1374.       exit 1
  1375.           ;;
  1376.     esac
  1377.  
  1378.     # Install the libtool object if requested.
  1379.     if test -n "$destfile"; then
  1380.       $show "$install_prog $file $destfile"
  1381.       $run $install_prog $file $destfile || exit $?
  1382.     fi
  1383.  
  1384.     # Install the old object if enabled.
  1385.     if test "$build_old_libs" = yes; then
  1386.       # Deduce the name of the old-style object file.
  1387.       staticobj=`echo "$file" | sed 's/\.lo$/\.o/;'`
  1388.  
  1389.       $show "$install_prog $staticobj $staticdest"
  1390.       $run $install_prog $staticobj $staticdest || exit $?
  1391.     fi
  1392.     exit 0
  1393.     ;;
  1394.  
  1395.       *)
  1396.     # Do a test to see if this is really a libtool program.
  1397.     if egrep "^# Generated by $PROGRAM" $file >/dev/null 2>&1; then
  1398.       # This variable tells wrapper scripts just to set variables rather
  1399.       # than running their programs.
  1400.       libtool_install_magic="$magic"
  1401.       link_against_libtool_libs=
  1402.       finalize_command=
  1403.  
  1404.       # If there is no directory component, then add one.
  1405.       case "$file" in
  1406.       */*) . $file ;;
  1407.       *) . ./$file ;;
  1408.       esac
  1409.  
  1410.       # Check the variables that should have been set.
  1411.       if test -z "$link_against_libtool_libs" || test -z "$finalize_command"; then
  1412.         echo "$progname: invalid libtool wrapper script \`$file'" 1>&2
  1413.         exit 1
  1414.       fi
  1415.  
  1416.       finalize=yes
  1417.       for lib in $link_against_libtool_libs; do
  1418.         # Check to see that each library is installed.
  1419.         libdir=
  1420.         if test -f "$lib"; then
  1421.           # If there is no directory component, then add one.
  1422.           case "$lib" in
  1423.           */*) . $lib ;;
  1424.           *) . ./$lib ;;
  1425.           esac
  1426.         fi
  1427.         libfile="$libdir/`echo "$lib" | sed 's%^.*/%%g'`"
  1428.         if test -z "$libdir"; then
  1429.           echo "$progname: warning: \`$lib' contains no -rpath information" 1>&2
  1430.         elif test -f "$libfile"; then :
  1431.         else
  1432.           echo "$progname: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
  1433.           finalize=no
  1434.         fi
  1435.       done
  1436.  
  1437.       if test "$hardcode_action" = relink; then
  1438.         if test "$finalize" = yes; then
  1439.           echo "$progname: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2
  1440.           $show "$finalize_command"
  1441.           if $run $finalize_command; then :
  1442.           else
  1443.         echo "$progname: error: relink \`$file' with the above command before installing it" 1>&2
  1444.         continue
  1445.           fi
  1446.           file="$objdir/$file"T
  1447.         else
  1448.           echo "$progname: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2
  1449.         fi
  1450.       else
  1451.         # Install the binary that we compiled earlier.
  1452.         dir=`echo "$file" | sed 's%/[^/]*$%%'`
  1453.         if test "$file" = "$dir"; then
  1454.           file="$objdir/$file"
  1455.         else
  1456.           file="$dir/$objdir/`echo "$file" | sed 's%^.*/%%'`"
  1457.         fi
  1458.       fi
  1459.     fi
  1460.  
  1461.     $show "$install_prog$stripme $file $dest"
  1462.     $run $install_prog$stripme $file $dest || exit $?
  1463.     ;;
  1464.       esac
  1465.     done
  1466.  
  1467.     for file in $staticlibs; do
  1468.       name=`echo "$file" | sed 's%^.*/%%'`
  1469.  
  1470.       # Set up the ranlib parameters.
  1471.       oldlib="$destdir/$name"
  1472.  
  1473.       $show "$install_prog $file $oldlib"
  1474.       $run $install_prog $file $oldlib || exit $?
  1475.  
  1476.       # Support stripping libraries.
  1477.       if test -n "$stripme"; then
  1478.     if test -n "$old_striplib"; then
  1479.       $show "$old_striplib $oldlib"
  1480.       $run $old_striplib $oldlib || exit $?
  1481.     else
  1482.       echo "$progname: warning: no static library stripping program" 1>&2
  1483.     fi
  1484.       fi
  1485.  
  1486.       # Do each command in the postinstall commands.
  1487.       cmds=`eval echo \"$old_postinstall_cmds\"`
  1488.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS=';'
  1489.       for cmd in $cmds; do
  1490.         IFS="$save_ifs"
  1491.         $show "$cmd"
  1492.         $run eval "$cmd" || exit $?
  1493.       done
  1494.       IFS="$save_ifs"
  1495.     done
  1496.  
  1497.     if test -n "$future_libdirs"; then
  1498.       echo "$progname: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
  1499.     fi
  1500.  
  1501.     if test -n "$current_libdirs"; then
  1502.       # Maybe just do a dry run.
  1503.       test -n "$run" && current_libdirs=" -n$current_libdirs"
  1504.       exec $0 --finish$current_libdirs
  1505.       exit 1
  1506.     fi
  1507.  
  1508.     exit 0
  1509.     ;;
  1510.  
  1511.   # libtool dlname mode
  1512.   dlname)
  1513.     progname="$progname: dlname"
  1514.     ltlibs="$nonopt"
  1515.     for lib
  1516.     do
  1517.       ltlibs="$ltlibs $lib"
  1518.     done
  1519.  
  1520.     if test -z "$ltlibs"; then
  1521.       echo "$progname: you must specify at least one LTLIBRARY" 1>&2
  1522.       echo "$help" 1>&2
  1523.       exit 1
  1524.     fi
  1525.  
  1526.     # Now check to make sure each one is a valid libtool library.
  1527.     status=0
  1528.     for lib in $ltlibs; do
  1529.       dlname=
  1530.       libdir=
  1531.       library_names=
  1532.  
  1533.       # Check to see that this really is a libtool archive.
  1534.       if egrep "^# Generated by $PROGRAM" $arg >/dev/null 2>&1; then :
  1535.       else
  1536.         echo "$progname: \`$arg' is not a valid libtool archive" 1>&2
  1537.     status=1
  1538.     continue
  1539.       fi
  1540.  
  1541.       # If there is no directory component, then add one.
  1542.       case "$arg" in
  1543.       */*) . $arg ;;
  1544.       *) . ./$arg ;;
  1545.       esac
  1546.  
  1547.       if test -z "$libdir"; then
  1548.         echo "$progname: \`$arg' contains no -rpath information" 1>&2
  1549.         status=1
  1550.       elif test -n "$dlname"; then
  1551.     echo "$libdir/$dlname"
  1552.       elif test -z "$library_names"; then
  1553.         echo "$progname: \`$arg' is not a shared library" 1>&2
  1554.         status=1
  1555.       else
  1556.         echo "$progname: \`$arg' was not linked with \`-export-dynamic'" 1>&2
  1557.         status=1
  1558.       fi
  1559.     done
  1560.     exit $status
  1561.     ;;
  1562.  
  1563.   # libtool finish mode
  1564.   finish)
  1565.     progname="$progname: finish"
  1566.     libdirs="$nonopt"
  1567.  
  1568.     if test -n "$finish_cmds" && test -n "$libdirs"; then
  1569.       for dir
  1570.       do
  1571.     libdirs="$libdirs $dir"
  1572.       done
  1573.  
  1574.       for libdir in $libdirs; do
  1575.     # Do each command in the postinstall commands.
  1576.     cmds=`eval echo \"$finish_cmds\"`
  1577.     IFS="${IFS=     }"; save_ifs="$IFS"; IFS=';'
  1578.     for cmd in $cmds; do
  1579.       IFS="$save_ifs"
  1580.       $show "$cmd"
  1581.       $run eval "$cmd"
  1582.     done
  1583.     IFS="$save_ifs"
  1584.       done
  1585.     fi
  1586.  
  1587.     echo "To link against installed libraries in LIBDIR, users may have to:"
  1588.     if test -n "$shlibpath_var"; then
  1589.       echo "   - add LIBDIR to their \`$shlibpath_var' environment variable"
  1590.     fi
  1591.     echo "   - use the \`-LLIBDIR' linker flag"
  1592.     exit 0
  1593.     ;;
  1594.  
  1595.   # libtool uninstall mode
  1596.   uninstall)
  1597.     progname="$progname: uninstall"
  1598.     rm="$nonopt"
  1599.     files=
  1600.  
  1601.     for arg
  1602.     do
  1603.       case "$arg" in
  1604.       -*) rm="$rm $arg" ;;
  1605.       *) files="$files $arg" ;;
  1606.       esac
  1607.     done
  1608.  
  1609.     if test -z "$rm"; then
  1610.       echo "$progname: you must specify an RM program" 1>&2
  1611.       echo "$help" 1>&2
  1612.       exit 1
  1613.     fi
  1614.  
  1615.     for file in $files; do
  1616.       dir=`echo "$file" | sed -e 's%/[^/]*$%%'`
  1617.       test "$dir" = "$file" && dir=.
  1618.       name=`echo "$file" | sed -e 's%^.*/%%'`
  1619.  
  1620.       rmfiles="$file"
  1621.  
  1622.       case "$name" in
  1623.       *.la)
  1624.     # Possibly a libtool archive, so verify it.
  1625.     if egrep "^# Generated by $PROGRAM" $file >/dev/null 2>&1; then
  1626.       . $dir/$name
  1627.  
  1628.       # Delete the libtool libraries and symlinks.
  1629.       for n in $library_names; do
  1630.         rmfiles="$rmfiles $dir/$n"
  1631.         test "X$n" = "X$dlname" && dlname=
  1632.       done
  1633.       test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname"
  1634.       test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
  1635.  
  1636.       # FIXME: should reinstall the best remaining shared library.
  1637.     fi
  1638.     ;;
  1639.  
  1640.       *.lo)
  1641.     if test "$build_old_libs" = yes; then
  1642.             oldobj=`echo "$name" | sed 's/\.lo$/\.o/'`
  1643.       rmfiles="$rmfiles $dir/$oldobj"
  1644.     fi
  1645.       ;;
  1646.       esac
  1647.  
  1648.       $show "$rm $rmfiles"
  1649.       $run $rm $rmfiles
  1650.     done
  1651.     exit 0
  1652.     ;;
  1653.  
  1654.   NONE)
  1655.     echo "$progname: you must specify a MODE" 1>&2
  1656.     echo "$generic_help" 1>&2
  1657.     exit 1
  1658.     ;;
  1659.   esac
  1660.  
  1661.   echo "$progname: invalid operation mode \`$mode'" 1>&2
  1662.   echo "$generic_help" 1>&2
  1663.   exit 1
  1664. fi # test -z "$show_help"
  1665.  
  1666. # We need to display help for each of the modes.
  1667. case "$mode" in
  1668. NONE) cat <<EOF
  1669. Usage: $progname [OPTION]... [MODE-ARG]...
  1670.  
  1671. Provide generalized library-building support services.
  1672.  
  1673. -n, --dry-run         display commands without modifying any files
  1674.     --features        display configuration information and exit
  1675.     --finish          same as \`--mode=finish'
  1676.     --help            display this help message and exit
  1677.     --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
  1678.     --version         print version information
  1679.  
  1680. MODE must be one of the following:
  1681.  
  1682.       compile         compile a source file into a libtool object
  1683.       dlname          print filenames to use to \`dlopen' libtool libraries
  1684.       finish          complete the installation of libtool libraries
  1685.       install         install libraries or executables
  1686.       link            create a library or an executable
  1687.       uninstall       remove libraries from an installed directory
  1688.  
  1689. MODE-ARGS vary depending on the MODE.  Try \`$progname --help --mode=MODE' for
  1690. a more detailed description of MODE.
  1691. EOF
  1692.   ;;
  1693.  
  1694. compile)
  1695.   cat <<EOF
  1696. Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  1697.  
  1698. Compile a source file into a libtool library object.
  1699.  
  1700. COMPILE-COMMAND is a command to be used in creating a \`standard' object file
  1701. from the given SOURCEFILE.
  1702.  
  1703. The output file name is determined by removing the directory component from
  1704. SOURCEFILE, then substituting the C source code suffix \`.c' with the
  1705. library object suffix, \`.lo'.
  1706. EOF
  1707.   ;;
  1708.  
  1709. dlname)
  1710.   cat <<EOF
  1711. Usage: $progname [OPTION]... --mode=dlname LTLIBRARY...
  1712.  
  1713. Print filenames to use to \`dlopen' libtool libraries.
  1714.  
  1715. Each LTLIBRARY is the name of a dynamically loadable libtool library (one that
  1716. was linked using the \`-export-dynamic' option).
  1717.  
  1718. The names to use are printed to standard output, one per line.
  1719. EOF
  1720.   ;;
  1721.  
  1722. finish)
  1723.   cat <<EOF
  1724. Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
  1725.  
  1726. Complete the installation of libtool libraries.
  1727.  
  1728. Each LIBDIR is a directory that contains libtool libraries.
  1729.  
  1730. The commands that this mode executes may require superuser privileges.  Use
  1731. the \`--dry-run' option if you just want to see what would be executed.
  1732. EOF
  1733.   ;;
  1734.  
  1735. install)
  1736.   cat <<EOF
  1737. Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
  1738.  
  1739. Install executables or libraries.
  1740.  
  1741. INSTALL-COMMAND is the installation command.  The first component should be
  1742. either the \`install' or \`cp' program.
  1743.  
  1744. The rest of the components are interpreted as arguments to that command (only
  1745. BSD-compatible install options are recognized).
  1746. EOF
  1747.   ;;
  1748.  
  1749. link)
  1750.   cat <<EOF
  1751. Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
  1752.  
  1753. Link object files or libraries together to form another library, or to
  1754. create an executable program.
  1755.  
  1756. LINK-COMMAND is a command using the C compiler that you would use to create
  1757. a program from several object files.
  1758.  
  1759. The following components of LINK-COMMAND are treated specially:
  1760.  
  1761.   -allow-undefined  allow a libtool library to reference undefined symbols
  1762.   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
  1763.   -LLIBDIR          search LIBDIR for required installed libraries
  1764.   -lNAME            OUTPUT-FILE requires the installed library libNAME
  1765.   -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
  1766.   -rpath LIBDIR     the created library will eventually be installed in LIBDIR
  1767.   -static           do not do any dynamic linking or shared library creation
  1768.   -version-info CURRENT[:REVISION[:AGE]]
  1769.             specify library version info [each variable defaults to 0]
  1770.  
  1771. All other options (arguments beginning with \`-') are ignored.
  1772.  
  1773. Every other argument is treated as a filename.  Files ending in \`.la' are
  1774. treated as uninstalled libtool libraries, other files are standard or library
  1775. object files.
  1776.  
  1777. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only
  1778. library objects (\`.lo' files) may be specified, and \`-rpath' is required.
  1779.  
  1780. If OUTPUT-FILE ends in \`.a', then a standard library is created using \`ar'
  1781. and \`ranlib'.
  1782.  
  1783. If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is
  1784. created, otherwise an executable program is created.
  1785. EOF
  1786.   ;;
  1787.  
  1788. uninstall)
  1789.   cat <<EOF
  1790. Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
  1791.  
  1792. Remove libraries from an installation directory.
  1793.  
  1794. RM is the name of the program to use to delete files associated with each FILE
  1795. (typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
  1796. to RM.
  1797.  
  1798. If FILE is a libtool library, all the files associated with it are deleted.
  1799. Otherwise, only FILE itself is deleted using RM.
  1800. EOF
  1801.   ;;
  1802.  
  1803. *)
  1804.   echo "$progname: invalid operation mode \`$mode'" 1>&2
  1805.   echo "$help" 1>&2
  1806.   exit 1
  1807.   ;;
  1808. esac
  1809.  
  1810. case "$mode" in
  1811. archive|compile)
  1812.   echo
  1813.   echo "Try \`$progname --help' for more information about other modes."
  1814.   ;;
  1815. esac
  1816.  
  1817. exit 0
  1818.  
  1819. # Local Variables:
  1820. # mode:shell-script
  1821. # sh-indentation:2
  1822. # End:
  1823.